<?
	require_once("../cBasic/950cons.php");
	
	$sTable=$_GET['obj'];
	$aColumns = array();
	
//SQL
	$sQuery="select  * from $sTable where Status <>0";
	$rResult = mysql_query( $sQuery, $con ) or die(mysql_error());
	
	$fields = mysql_num_fields($rResult);
	
	for ($i=0; $i<$fields; $i++){
		if (mysql_field_name ($rResult,$i)=='Status'){continue;}
		else $aColumns[] = mysql_field_name ($rResult,$i);
	}
	
	
	$sIndexColumn = mysql_field_name ($rResult,0);
	
	$output = array();
	
	$output['title'] = $aColumns;
	$output["aaData"] = array();
	
	
	while ( $aRow = mysql_fetch_array( $rResult ) )
	{
		$row = array();
		for ( $i=0 ; $i<count($aColumns) ; $i++ )
		{
			if ( $aColumns[$i] != ' ' && $aColumns[$i]!='Status' )
			{
				/* General output */
				$row[] = $aRow[ $aColumns[$i] ];
			}
		}
		$output['aaData'][] = $row;
	}
	mysql_close($con);
	
	
	echo json_encode( $output );
?>